<?php

namespace App\Http\Middleware;

use Closure;

class Login
{
    /**
     * Handle an incoming request.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \Closure  $next
     * @return mixed
     */
    public function handle($request, Closure $next)
    {
        /**
        *使用中间件检测用户登录状态
        *@return redirect 如果没有检测到session,跳转到登录页面
        *@return $next 如果检测到session,执行下一步操作
        */
        if(!session('member')){
            return redirect('manager/login');
        }
        return $next($request);
    }
}
